﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<div id="assignerPage" class="main-content">

    <div class="panel panel-default" v-if="isNotEmptyObject(equipmentList)">
        <div class="panel-heading">
            <h3 class="panel-title">所属负责设备列表List of responsible equipment</h3>
            <div class="right">
                <button type="button" class="btn-toggle-collapse"><i class="fa fa-angle-up"></i></button>
            </div>
        </div>
        <div class="panel-body">
            <table class="table">
                <thead>
                    <tr>
                        <td colspan="11">
                            <div class="form-inline text-right">
                                <label class="control-label">每页记录数Records per page：</label>
                                <select class="form-control input-sm" style="width:auto;" v-model="pageModel.pageSize">
                                    <option value="10">10条Article 10</option>
                                    <option value="30">30条Article 30</option>
                                    <option value="50">50条Article 50</option>
                                </select>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>设备编号Equipment number</th>
                        <th>设备名称Equipment name</th>
                        <th>设备型号equipment model</th>
                        <th>设备序列号Equipment serial number</th>
                        <th>使用场所place of use</th>
                        <th>使用状态usage status</th>
                        <th>保养状态maintenance status</th>
                        <th>最后保养日期Last maintenance date</th>
                        <th>预计保养日期Estimated maintenance date</th>
                        <th>管理人administrator</th>
                        <th>操作operation</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(equipment, index) in equipmentList">
                        <td>{{equipment.BaseInfo.Code}}</td>
                        <td>{{equipment.BaseInfo.Name}}</td>
                        <td>{{equipment.BaseInfo.Model}}</td>
                        <td>{{equipment.BaseInfo.Sn}}</td>
                        <td>{{equipment.BaseInfo.Floor}}</td>
                        <td>
                            <span v-for="(value, key, idx) in statusDictionary">
                                <span v-if="value == equipment.BaseInfo.Status">{{key}}</span>
                            </span>
                        </td>
                        <td>
                            @*<span v-for="(value, key, idx) in maintStatusDictionary">
                                <span v-if="value == equipment.MaintainInfo.IsNeed">{{key}}</span>
                            </span>*@
                            待保养To be maintained
                        </td>
                        <td>{{equipment.MaintainInfo.LastMaintainDate}}</td>
                        <td>{{equipment.MaintainInfo.NextMaintainDate}}</td>
                        <td>{{equipment.ManagerInfo.NameChs}}</td>
                        <td>
                            <button type="button" class="btn btn-info btn-sm" v-on:click="EditEquipment(equipment.BaseInfo.ID)">
                                <i class="fa fa-edit"></i> 详细detailed
                            </button>
                            <button type="button" class="btn btn-success btn-sm" v-on:click="AddMaintainRecord(equipment.BaseInfo.ID)">
                                <i class="fa fa-file"></i> 保养maintain
                            </button>
                        </td>
                    </tr>
                </tbody>
                <tbody>
                    <tr>
                        <td colspan="11">
                            <nav class="text-right" aria-label="Page navigation">
                                <ul class="pagination">
                                    <li v-if="pageModel.pageIdx > 1">
                                        <a href="#" aria-label="Previous" v-on:click="GotoPage(pageModel.pageIdx - 1)">
                                            <span aria-hidden="true">
                                                <i class="fa fa-angle-left"></i> 上一页previous page
                                            </span>
                                        </a>
                                    </li>
                                    <li v-if="pageModel.pageIdx != 1">
                                        <a href="#" v-on:click="GotoPage(1)">
                                            <i class="fa fa-step-backward"></i>
                                        </a>
                                    </li>
                                    <template v-for="idx in pageModel.pageLength">
                                        <li v-if="pageModel.pageIdx - idx > -5 && pageModel.pageIdx - idx < 5 " v-bind:class="pageModel.pageIdx == idx ? 'active' : ''">
                                            <a href="#" v-on:click="GotoPage(idx)">{{idx}}</a>
                                        </li>
                                    </template>
                                    <li v-if="pageModel.pageIdx != pageModel.pageLength">
                                        <a href="#" v-on:click="GotoPage(pageModel.pageLength)">
                                            <i class="fa fa-step-forward"></i>
                                        </a>
                                    </li>
                                    <li v-if="pageModel.pageIdx < pageModel.pageLength">
                                        <a href="#" aria-label="Next" v-on:click="GotoPage(pageModel.pageIdx + 1)">
                                            <span aria-hidden="true">
                                                下一页next page <i class="fa fa-angle-right"></i>
                                            </span>
                                        </a>
                                    </li>
                                </ul>
                            </nav>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="panel" v-if="isNotEmptyObject(maintainRecordList)">
        <div class="panel-heading">
            <h3 class="panel-title">保养记录列表Maintenance record list</h3>
            <div class="right">
                <button type="button" class="btn-toggle-collapse"><i class="fa fa-angle-up"></i></button>
            </div>
        </div>
        <div class="panel-body">
            <div class="alert alert-warning">
                <span>每次仅获取最多200条记录，请及时处理数据Only 200 records can be obtained at most each time. Please process the data in time。</span>
            </div>
            <div>
                <button class="btn btn-success btn-sm" v-on:click="BatchSubmitMaintainRecord">
                    <i class="fa fa-upload"></i> 批量提交Batch submission
                </button>
                <button class="btn btn-danger btn-sm" v-on:click="BatchDeleteMaintainRecord">
                    <i class="fa fa-trash"></i> 批量删除Batch delete
                </button>
            </div>
            <table class="table">
                <thead>
                    <tr>
                        <th>
                            <input id="selectAllBox" type="checkbox" v-on:change="SelectAllMaintainRecord" />
                        </th>
                        <th>保养单编号Maintenance order number</th>
                        <th>设备编号Equipment number</th>
                        <th>设备模板equipment template</th>
                        <th>保养日期Maintenance date</th>
                        <th>申请日期application date</th>
                        <th>签核状态Sign off status</th>
                        <th>管理人(签核)Administration(sign off)</th>
                        <th>操作operation</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(record, index) in maintainRecordList" v-bind:key="record.BaseInfo.ID">
                        <td>
                            <input class="record-box" type="checkbox" v-bind:value="record.BaseInfo.ID" />
                        </td>
                        <td>{{record.BaseInfo.ID}}</td>
                        <td>{{record.Equipment.BaseInfo.Code}}</td>
                        <td>{{record.Equipment.BaseInfo.Name}}</td>
                        <td>{{record.BaseInfo.RecordDate}}</td>
                        <td>{{record.BaseInfo.UpdateDate}}</td>
                        <td>
                            <span v-for="(value, key, idx) in approvalStatusDictionary">
                                <span v-if="value == record.BaseInfo.Status">{{key}}</span>
                            </span>
                        </td>
                        <td>{{record.ApproverInfo.NameChs}}</td>
                        <td>
                            <span v-if="record.BaseInfo.Status == 0">
                                <button class="btn btn-success btn-sm" v-on:click="SubmitMaintainRecord(record.BaseInfo.ID)">
                                    <i class="fa fa-upload"></i> 提交Submit
                                </button>
                                <button class="btn btn-info btn-sm" v-on:click="EditMaintainRecord(record.BaseInfo.ID)">
                                    <i class="fa fa-edit"></i> 编辑edit
                                </button>
                                <button class="btn btn-danger btn-sm" v-on:click="DeleteMaintainRecord(record)">
                                    <i class="fa fa-trash"></i> 删除delete
                                </button>
                            </span>
                            <span v-if="record.BaseInfo.Status == 1">
                                <button class="btn btn-warning btn-sm" v-on:click="ApproveMaintainRecord(record.BaseInfo.ID)">
                                    <i class="fa fa-pencil"></i> 签核详细Sign off details
                                </button>
                            </span>
                            <span v-if="record.BaseInfo.Status == 2">
                                <button class="btn btn-warning btn-sm" v-on:click="ApproveMaintainRecord(record.BaseInfo.ID)">
                                    <i class="fa fa-pencil"></i> 签核详细Sign off details
                                </button>
                            </span>
                            <span v-if="record.BaseInfo.Status == 3">
                                <button class="btn btn-success btn-sm" v-on:click="SubmitMaintainRecord(record.BaseInfo.ID)">
                                    <i class="fa fa-upload"></i> 重新提交Resubmit
                                </button>
                                <button class="btn btn-warning btn-sm" v-on:click="ApproveMaintainRecord(record.BaseInfo.ID)">
                                    <i class="fa fa-pencil"></i> 签核详细Sign off details
                                </button>
                                <button class="btn btn-info btn-sm" v-on:click="EditMaintainRecord(record.BaseInfo.ID)">
                                    <i class="fa fa-edit"></i> 编辑edit
                                </button>
                                <button class="btn btn-danger btn-sm" v-on:click="DeleteMaintainRecord(record)">
                                    <i class="fa fa-trash"></i> 删除delete
                                </button>
                            </span>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

@section scripts{
    <script type="text/javascript" src="~/Scripts/pageJs/Home/Assigner.js?v=@DateTime.Now.ToFileTimeUtc()"></script>
}

